package es.battleship.model;

import javax.xml.bind.annotation.adapters.XmlAdapter;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;

public class KeyAdapter  extends XmlAdapter<Long,Key> {

	@Override
	public Long marshal(Key key) throws Exception {
		return key.getId();
	}

	@Override
	public Key unmarshal(Long id) throws Exception {
		return  KeyFactory.createKey(PlayerPair.class.getSimpleName(), id);
	}

}
